@@ -37,6 +37,14 @@ angular.module('codexApp.header', []) |
||
37 | 37 |
$rootScope.$broadcast('sidebar:toogle'); |
38 | 38 |
} |
39 | 39 |
|
40 |
+ // Go To Home note |
|
41 |
+ $scope.goToHome = function() { |
|
42 |
+ FileService.setCurrentNote(FileService.getDefaultNote()); |
|
43 |
+ $rootScope.$broadcast('note-view:reload'); |
|
44 |
+ $state.go("note-view"); |
|
45 |
+ } |
|
46 |
+ |
|
47 |
+ |
|
40 | 48 |
// Note View active button |
41 | 49 |
|
42 | 50 |
$scope.activateNoteView = function() { |
@@ -64,7 +64,7 @@ angular.module('codexApp.noteView', []) |
||
64 | 64 |
FileService.setCurrentNote(note); |
65 | 65 |
$scope.note = note; |
66 | 66 |
console.log("-> Opening Link: " + note.path) |
67 |
- $scope.loadNoteView() |
|
67 |
+ $scope.loadNoteView(); |
|
68 | 68 |
} |
69 | 69 |
|
70 | 70 |
|
@@ -77,6 +77,12 @@ angular.module('codexApp.noteView', []) |
||
77 | 77 |
|
78 | 78 |
$scope.loadNoteView(); |
79 | 79 |
|
80 |
+ $rootScope.$on('note-view:reload', function() { |
|
81 |
+ $scope.note = FileService.getCurrentNote(); |
|
82 |
+ $scope.html_data = ""; |
|
83 |
+ $scope.loadNoteView(); |
|
84 |
+ }); |
|
85 |
+ |
|
80 | 86 |
$scope.fixImgURLs = function(current_note_path, html){ |
81 | 87 |
// var images = html.getElementsByTagName('img'); |
82 | 88 |
// var srcList = []; |
@@ -3,6 +3,7 @@ angular.module('codexApp') |
||
3 | 3 |
|
4 | 4 |
var notes_dir = "/Users/james/dev/codex/codex"; |
5 | 5 |
var default_notes_dir = "/Users/james/dev/codex/codex/inbox"; |
6 |
+ var default_home_note = "/Users/james/dev/codex/codex/index.md" |
|
6 | 7 |
var notes = []; |
7 | 8 |
var current_note = ""; |
8 | 9 |
|
@@ -171,7 +172,7 @@ angular.module('codexApp') |
||
171 | 172 |
}); |
172 | 173 |
} |
173 | 174 |
|
174 |
- this.getNote = function(file_path){ |
|
175 |
+ var getNote = function(file_path){ |
|
175 | 176 |
var filesystem = require("fs"); |
176 | 177 |
var stat = filesystem.statSync(file_path); |
177 | 178 |
var file_obj = { |
@@ -196,6 +197,10 @@ angular.module('codexApp') |
||
196 | 197 |
return getAllFilesFromFolder(); |
197 | 198 |
} |
198 | 199 |
|
200 |
+ this.getNote = function(path) { |
|
201 |
+ return getNote(path); |
|
202 |
+ } |
|
203 |
+ |
|
199 | 204 |
this.getCurrentNote = function() { |
200 | 205 |
return current_note; |
201 | 206 |
} |
@@ -215,4 +220,8 @@ angular.module('codexApp') |
||
215 | 220 |
return default_notes_dir; |
216 | 221 |
} |
217 | 222 |
|
223 |
+ this.getDefaultNote = function() { |
|
224 |
+ return getNote(default_home_note); |
|
225 |
+ } |
|
226 |
+ |
|
218 | 227 |
}]) |